package com.jp.memory;

import java.util.concurrent.TimeUnit;

/**
 * 栈溢出
 *
 *
 * */
public class Mytest2 {
    private  int length;

    public int getLength() {
        return length;
    }

    public void test(){
        try {
            TimeUnit.MICROSECONDS.sleep(300);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        this.length++;
        test();
    }

    public static void main(String[] args) throws InterruptedException {
        Mytest2 mytest2 = new Mytest2();
        try {
            mytest2.test();
        }catch (Throwable ex) {
            System.out.println(mytest2.getLength());
            //ex.printStackTrace();
        }
        TimeUnit.SECONDS.sleep(100);
    }
}
